﻿			<div>
				<ul class="breadcrumb">
					<li>
						<a href="<?php echo site_url("menu/survey"); ?>">Quản lý khảo sát</a> / 
                        <a href="<?php echo site_url("surveytype"); ?>">Loại khảo sát</a> / 
                        <a href="<?php echo site_url("survey/index/".$st->survey_type_id);?>"><?php echo $st->survey_type_name; ?></a> / 
						<?php echo $survey->survey_name; ?></a>
					</li>
				</ul>
			</div>
			<div class="row-fluid">
				<div class="box span12">
					<div class="box-header well">
						<h2><i class="icon-eye-open"></i> Chi tiết phiếu khảo sát</h2>
						<div class="box-icon">
							<a href="#" class="btn btn-minimize btn-round"><i class="icon-chevron-up"></i></a>
						</div>
					</div>
					<div class="box-content">
						<form class="form-horizontal" method="post">
							<fieldset>
								<div class="control-group">
									<label class="control-label">Tên phiếu khảo sát</label>
									<div class="controls">
										<label class="radio inline">
											<?php echo $survey->survey_name;?>
										</label>
									</div>
								</div>
								<div class="control-group">
									<label class="control-label">Loại khảo sát</label>
									<div class="controls">
										<label class="radio inline">
											<?php echo $st->survey_type_name;?>
										</label>
									</div>
								</div>
								<?php if($survey->is_graduated == FALSE){?>
								<div class="control-group">
									<label class="control-label">Khóa</label>
									<div class="controls">
										<label class="radio inline">
											<?php echo $survey->course;?>
										</label>
									</div>
								</div>
								<?php }else{?>
								<div class="control-group">
									<label class="control-label">Năm tốt nghiệp</label>
									<div class="controls">
										<label class="radio inline">
											<?php echo $survey->graduated_year;?>
										</label>
									</div>
								</div>
								<?php };?>
								<div class="control-group">
									<label class="control-label">Thời gian áp dụng</label>
									<div class="controls">
										<label class="radio inline">
											Từ <?php echo $survey->start_date;?>
											đến <?php echo $survey->end_date;?>
										</label>
									</div>
								</div>
								<div class="control-group">
									<label class="control-label">Trạng thái</label>
									<div class="controls">
										<label class="radio inline">
											<?php if($survey->status == 0){?>
												Chưa mở
											<?php }else if($survey->status == 1){?>
												Đang mở
												<a href="#closeModal" class="btn-setting" sid="<?php echo $survey->survey_id;?>" sname="<?php echo $survey->survey_name;?>">
													(Đóng khảo sát)
												</a>
											<?php }else if($survey->status == 2){?>
												Đóng
												<?php if($survey->start_date<=mdate('%m/%d/%Y %H:%i:%s',now()) && $survey->end_date>=mdate('%m/%d/%Y %H:%i:%s',now())){?>
													<a href="#openModal" class="btn-setting" sid="<?php echo $survey->survey_id;?>" sname="<?php echo $survey->survey_name;?>">
														(Mở khảo sát)
													</a>
												<?php }?>
											<?php };?>
										</label>
									</div>
								</div>
								<div class="control-group">
									<label class="control-label">Địa chỉ trang khảo sát</label>
									<div class="controls">
										<label class="radio inline">
											<a href="http://khaosat.vanlanguni.edu.vn">
												http://khaosat.vanlanguni.edu.vn
											</a>
											(Click vào để xem phiếu khảo sát)
										</label>
									</div>
								</div>
								<div class="form-actions">
									<?php if($survey->status =='2'){?>
										<a class="btn btn-info btn-setting" href="#notifyeditModal" sname="<?php echo $survey->survey_name;?>">
											<i class="icon-edit icon-white"></i> Sửa
										</a>
									<?php }else{?>
										<a class="btn btn-info" href="<?php echo site_url("survey/edit_step1/".$survey->survey_id);?>">
											<i class="icon-edit icon-white"></i> Sửa
										</a>
									<?php };?>
									<a class="btn btn-danger btn-setting" href="#deleteModal" sid="<?php echo $survey->survey_id;?>" sname="<?php echo $survey->survey_name;?>">
										<i class="icon-trash icon-white"></i> Xoá
									</a>
									<a class="btn btn-primary" href="<?php echo site_url("inform/index/".$survey->survey_id);?>"><i class="icon-envelope icon-white"></i> Thông báo</a>
									<a class="btn btn-primary" href="<?php echo site_url("surveyresult/index/".$survey->survey_id);?>"><i class="icon-list icon-white"></i> Kết quả khảo sát</a>
									<a class="btn btn-primary" href="<?php echo site_url("validation/index/".$survey->survey_id);?>"><i class="icon-check icon-white"></i> Kiểm tra độ tin cậy</a>
									<a class="btn btn-primary" href="<?php echo site_url("evaluation/index/".$survey->survey_id);?>"><i class="icon-ok-circle icon-white"></i> Đánh giá</a>
								</div>
							</fieldset>
						</form>
					</div>
				</div><!--/span-->
            </div>
    <!-- Hidden dialog -->     
        <!-- Popup delete survey -->
		<div class="modal hide fade" id="deleteModal">
				<div class="modal-header">
					<button type="button" class="close" data-dismiss="modal">×</button>
					<h3>Xóa phiếu khảo sát</h3>
				</div>
                <!-- <form class="form-horizontal"> -->
                <form class="form-horizontal" method="post">
    				<div class="modal-body">
    					<fieldset>
    						<div class="control-group">
                                Bạn có chấp nhận xoá phiếu khảo sát <b><span id="dsname"></span></b> không?
                                <input id="dsid" name="sid" type="hidden"/>
    						</div>
    					</fieldset>
    				</div>
    				<div class="modal-footer">
    					<a href="#" class="btn" data-dismiss="modal">Thoát</a>
    					<button type="submit" name="submit" value="delete" class="btn btn-primary">Đồng ý</button>
    				</div>
                </form>
			<!-- </form> -->
		</div>
        <!-- Popup notify can't delete survey -->
		<div class="modal hide fade" id="notifyModal">
				<div class="modal-header">
					<button type="button" class="close" data-dismiss="modal">×</button>
					<h3>Không thể xóa phiếu khảo sát</h3>
				</div>
    				<div class="modal-body">
    					<fieldset>
    						<div class="control-group">
                                Đã tồn tại dữ liệu khảo sát thuộc phiếu <b><span id="nsname"></span></b>.
    						</div>
    					</fieldset>
    				</div>
    				<div class="modal-footer">
    					<a href="#" class="btn" data-dismiss="modal">Thoát</a>
    				</div>
		</div>
        <!-- Popup close survey -->
		<div class="modal hide fade" id="closeModal">
				<div class="modal-header">
					<button type="button" class="close" data-dismiss="modal">×</button>
					<h3>Đóng khảo sát</h3>
				</div>
                <!-- <form class="form-horizontal"> -->
                <form class="form-horizontal" method="post">
    				<div class="modal-body">
    					<fieldset>
    						<div class="control-group">
                                Bạn có chấp nhận đóng khảo sát <b><span id="csname"></span></b> không?
                                <input id="csid" name="sid" type="hidden"/>
    						</div>
    					</fieldset>
    				</div>
    				<div class="modal-footer">
    					<a href="#" class="btn" data-dismiss="modal">Thoát</a>
    					<button type="submit" name="submit" value="close" class="btn btn-primary">Đồng ý</button>
    				</div>
                </form>
			<!-- </form> -->
		</div>
        <!-- Popup reopen survey -->
		<div class="modal hide fade" id="openModal">
				<div class="modal-header">
					<button type="button" class="close" data-dismiss="modal">×</button>
					<h3>Mở khảo sát</h3>
				</div>
                <!-- <form class="form-horizontal"> -->
                <form class="form-horizontal" method="post">
    				<div class="modal-body">
    					<fieldset>
    						<div class="control-group">
                                Bạn có chấp nhận mở khảo sát <b><span id="osname"></span></b> không?
                                <input id="osid" name="sid" type="hidden"/>
    						</div>
    					</fieldset>
    				</div>
    				<div class="modal-footer">
    					<a href="#" class="btn" data-dismiss="modal">Thoát</a>
    					<button type="submit" name="submit" value="open" class="btn btn-primary">Đồng ý</button>
    				</div>
                </form>
			<!-- </form> -->
		</div>
		<!-- Popup notify can't edit survey -->
		<div class="modal hide fade" id="notifyeditModal">
				<div class="modal-header">
					<button type="button" class="close" data-dismiss="modal">×</button>
					<h3>Không thể sửa phiếu khảo sát</h3>
				</div>
    				<div class="modal-body">
    					<fieldset>
    						<div class="control-group">
                                Phiếu khảo sát <b><span id="nesname"></span></b> đã được đóng.
    						</div>
    					</fieldset>
    				</div>
    				<div class="modal-footer">
    					<a href="#" class="btn" data-dismiss="modal">Thoát</a>
    				</div>
		</div>
        <!-- Popup notify can't connect to server -->
		<div class="modal hide fade" id="errorModal">
				<div class="modal-header">
					<button type="button" class="close" data-dismiss="modal">×</button>
					<h3>Error!!!</h3>
				</div>
    				<div class="modal-body">
    					<fieldset>
    						<div class="control-group">
                                Lỗi kết nối đến máy chủ.
    						</div>
    					</fieldset>
    				</div>
    				<div class="modal-footer">
    					<a href="#" class="btn" data-dismiss="modal">Thoát</a>
    				</div>
		</div>
    <!-- Placed at the end of the document so the pages load faster -->
    <!-- Internal Script -->
    <script type="text/javascript">
        $(document).ready(function(){
            //Event of button Delete Survey
            $('a[href="#deleteModal"]').click(function(){
                var sid = $(this).attr("sid");
                var sname = $(this).attr("sname");
                //Check whether Survey can be deleted
                $.get("<?php echo base_url();?>survey/check_delete/" + sid,function(data, result){
					if(result == "success"){
						if(data == true){
							$("#dsid").val(sid);
							$("#dsname").html(sname);
							$("#deleteModal").modal('show');
						}
						else if(data == false){
							$("#nsname").html(sname);
							$("#notifyModal").modal('show');
						}
					}else
						$("#errorModal").modal('show');
                });
            });
			//Event of button close Survey
            $('a[href="#closeModal"]').click(function(){
                var sid = $(this).attr("sid");
                var sname = $(this).attr("sname");
                //Check whether Survey can be deleted
				$("#csid").val(sid);
				$("#csname").html(sname);
				$("#closeModal").modal('show');
            });
			//Event of button close Survey
            $('a[href="#openModal"]').click(function(){
                var sid = $(this).attr("sid");
                var sname = $(this).attr("sname");
                //Check whether Survey can be deleted
				$("#osid").val(sid);
				$("#osname").html(sname);
				$("#openModal").modal('show');
            });
			//Event of button edit Survey
            $('a[href="#notifyeditModal"]').click(function(){
                var sname = $(this).attr("sname");
                //Check whether Survey can be deleted
				$("#nesname").html(sname);
				$("#notifyeditModal").modal('show');
            });
        });
    </script>
    <!-- End Internal Script -->